cmake_minimum_required(VERSION 3.10)

#set(CMAKE_CXX_STANDARD 14)
message("cmakedemo acclib:>>>>>>")
message("CMAKE_LIBRARY_OUTPUT_DIRECTORY = ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
message("CMAKE_RUNTIME_OUTPUT_DIRECTORY  = ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
#message("cmakedemo_SOURCE_DIR  = ${cmakedemo_SOURCE_DIR}")
#message("cmakedemo_BINARY_DIR  = ${cmakedemo_BINARY_DIR}")

add_definitions(-DDLL_EXPORTS)

# only valid in the folder acclib
set(RUNTIME_OUTPUT_DIRECTORY ${cmakedemo_BINARY_DIR})
message("RUNTIME_OUTPUT_DIRECTORY = ${RUNTIME_OUTPUT_DIRECTORY}")
message("LIBRARY_OUTPUT_PATH = ${LIBRARY_OUTPUT_PATH}")

# 生成动态库
add_library(acclib SHARED library.cpp library.h) # 生成一个动态链接库
#add_library(acclib_static STATIC library.cpp library.h) # 诉生成一个库文件。
#SET_TARGET_PROPERTIES (acclib_static PROPERTIES OUTPUT_NAME "acclib")

# copy the dll to the binary folder
#add_custom_command(TARGET acclib POST_BUILD         # Adds a post-build event to cmakedemo
#    COMMAND ${CMAKE_COMMAND} -E copy_if_different      # which executes "cmake - E copy_if_different..."
#        "${CMAKE_CURRENT_BINARY_DIR}/acclib.dll"   # <--this is in-file
#        "${CMAKE_CURRENT_BINARY_DIR}/../acclib.dll"                  # <--this is out-file path
#    )

message("acclib CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}")
message("cmakedemo acclib:<<<<<<")
